{"ast":null,"code":"import { useRef } from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nvar SMOOTH_PTG = 14 / 15;\nexport default function useMobileTouchMove(inVirtual, listRef, callback) {\n  var touchedRef = useRef(false);\n  var touchYRef = useRef(0);\n  var elementRef = useRef(null);\n  // Smooth scroll\n  var intervalRef = useRef(null);\n  /* eslint-disable prefer-const */\n  var cleanUpEvents;\n  var onTouchMove = function onTouchMove(e) {\n    if (touchedRef.current) {\n      var currentY = Math.ceil(e.touches[0].pageY);\n      var offsetY = touchYRef.current - currentY;\n      touchYRef.current = currentY;\n      if (callback(offsetY)) {\n        e.preventDefault();\n      }\n      // Smooth interval\n      clearInterval(intervalRef.current);\n      intervalRef.current = setInterval(function () {\n        offsetY *= SMOOTH_PTG;\n        if (!callback(offsetY, true) || Math.abs(offsetY) <= 0.1) {\n          clearInterval(intervalRef.current);\n        }\n      }, 16);\n    }\n  };\n  var onTouchEnd = function onTouchEnd() {\n    touchedRef.current = false;\n    cleanUpEvents();\n  };\n  var onTouchStart = function onTouchStart(e) {\n    cleanUpEvents();\n    if (e.touches.length === 1 && !touchedRef.current) {\n      touchedRef.current = true;\n      touchYRef.current = Math.ceil(e.touches[0].pageY);\n      elementRef.current = e.target;\n      elementRef.current.addEventListener('touchmove', onTouchMove);\n      elementRef.current.addEventListener('touchend', onTouchEnd);\n    }\n  };\n  cleanUpEvents = function cleanUpEvents() {\n    if (elementRef.current) {\n      elementRef.current.removeEventListener('touchmove', onTouchMove);\n      elementRef.current.removeEventListener('touchend', onTouchEnd);\n    }\n  };\n  useLayoutEffect(function () {\n    if (inVirtual) {\n      listRef.current.addEventListener('touchstart', onTouchStart);\n    }\n    return function () {\n      var _listRef$current;\n      (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.removeEventListener('touchstart', onTouchStart);\n      cleanUpEvents();\n      clearInterval(intervalRef.current);\n    };\n  }, [inVirtual]);\n}","map":{"version":3,"names":["useRef","useLayoutEffect","SMOOTH_PTG","useMobileTouchMove","inVirtual","listRef","callback","touchedRef","touchYRef","elementRef","intervalRef","cleanUpEvents","onTouchMove","e","current","currentY","Math","ceil","touches","pageY","offsetY","preventDefault","clearInterval","setInterval","abs","onTouchEnd","onTouchStart","length","target","addEventListener","removeEventListener","_listRef$current"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js"],"sourcesContent":["import { useRef } from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nvar SMOOTH_PTG = 14 / 15;\nexport default function useMobileTouchMove(inVirtual, listRef, callback) {\n  var touchedRef = useRef(false);\n  var touchYRef = useRef(0);\n  var elementRef = useRef(null);\n  // Smooth scroll\n  var intervalRef = useRef(null);\n  /* eslint-disable prefer-const */\n  var cleanUpEvents;\n  var onTouchMove = function onTouchMove(e) {\n    if (touchedRef.current) {\n      var currentY = Math.ceil(e.touches[0].pageY);\n      var offsetY = touchYRef.current - currentY;\n      touchYRef.current = currentY;\n      if (callback(offsetY)) {\n        e.preventDefault();\n      }\n      // Smooth interval\n      clearInterval(intervalRef.current);\n      intervalRef.current = setInterval(function () {\n        offsetY *= SMOOTH_PTG;\n        if (!callback(offsetY, true) || Math.abs(offsetY) <= 0.1) {\n          clearInterval(intervalRef.current);\n        }\n      }, 16);\n    }\n  };\n  var onTouchEnd = function onTouchEnd() {\n    touchedRef.current = false;\n    cleanUpEvents();\n  };\n  var onTouchStart = function onTouchStart(e) {\n    cleanUpEvents();\n    if (e.touches.length === 1 && !touchedRef.current) {\n      touchedRef.current = true;\n      touchYRef.current = Math.ceil(e.touches[0].pageY);\n      elementRef.current = e.target;\n      elementRef.current.addEventListener('touchmove', onTouchMove);\n      elementRef.current.addEventListener('touchend', onTouchEnd);\n    }\n  };\n  cleanUpEvents = function cleanUpEvents() {\n    if (elementRef.current) {\n      elementRef.current.removeEventListener('touchmove', onTouchMove);\n      elementRef.current.removeEventListener('touchend', onTouchEnd);\n    }\n  };\n  useLayoutEffect(function () {\n    if (inVirtual) {\n      listRef.current.addEventListener('touchstart', onTouchStart);\n    }\n    return function () {\n      var _listRef$current;\n      (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.removeEventListener('touchstart', onTouchStart);\n      cleanUpEvents();\n      clearInterval(intervalRef.current);\n    };\n  }, [inVirtual]);\n}"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,IAAIC,UAAU,GAAG,EAAE,GAAG,EAAE;AACxB,eAAe,SAASC,kBAAkB,CAACC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAE;EACvE,IAAIC,UAAU,GAAGP,MAAM,CAAC,KAAK,CAAC;EAC9B,IAAIQ,SAAS,GAAGR,MAAM,CAAC,CAAC,CAAC;EACzB,IAAIS,UAAU,GAAGT,MAAM,CAAC,IAAI,CAAC;EAC7B;EACA,IAAIU,WAAW,GAAGV,MAAM,CAAC,IAAI,CAAC;EAC9B;EACA,IAAIW,aAAa;EACjB,IAAIC,WAAW,GAAG,SAASA,WAAW,CAACC,CAAC,EAAE;IACxC,IAAIN,UAAU,CAACO,OAAO,EAAE;MACtB,IAAIC,QAAQ,GAAGC,IAAI,CAACC,IAAI,CAACJ,CAAC,CAACK,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC;MAC5C,IAAIC,OAAO,GAAGZ,SAAS,CAACM,OAAO,GAAGC,QAAQ;MAC1CP,SAAS,CAACM,OAAO,GAAGC,QAAQ;MAC5B,IAAIT,QAAQ,CAACc,OAAO,CAAC,EAAE;QACrBP,CAAC,CAACQ,cAAc,EAAE;MACpB;MACA;MACAC,aAAa,CAACZ,WAAW,CAACI,OAAO,CAAC;MAClCJ,WAAW,CAACI,OAAO,GAAGS,WAAW,CAAC,YAAY;QAC5CH,OAAO,IAAIlB,UAAU;QACrB,IAAI,CAACI,QAAQ,CAACc,OAAO,EAAE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